<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */
use Hyperf\HttpServer\Router\Router;

Router::addRoute(['GET', 'POST', 'HEAD'], '/api/', 'App\Controller\IndexController@index');

Router::addGroup('/api/user',function (){
    Router::get('/category', 'App\Controller\UserCategoryController@index');
    Router::get('/category/show/{id}', 'App\Controller\UserCategoryController@show');
    Router::post('/category/store', 'App\Controller\UserCategoryController@store');
    Router::post('/category/update/{id}', 'App\Controller\UserCategoryController@update');
    Router::post('/category/destroy/{id}', 'App\Controller\UserCategoryController@destroy');
    
    Router::get('/tag', 'App\Controller\UserTagController@index');
    Router::get('/tag/show/{id}', 'App\Controller\UserTagController@show');
    Router::post('/tag/store', 'App\Controller\UserTagController@store');
    Router::post('/tag/update/{id}', 'App\Controller\UserTagController@update');
    Router::post('/tag/destroy/{id}', 'App\Controller\UserTagController@destroy');

    Router::get('/material', 'App\Controller\UserMaterialController@index');
    Router::get('/material/show/{id}', 'App\Controller\UserMaterialController@show');
    Router::post('/material/store', 'App\Controller\UserMaterialController@store');
    Router::post('/material/update/{id}', 'App\Controller\UserMaterialController@update');
    Router::post('/material/destroy/{id}', 'App\Controller\UserMaterialController@destroy');

    Router::get('/library', 'App\Controller\UserLibraryController@index');
    Router::get('/library/show/{id}', 'App\Controller\UserLibraryController@show');
    Router::post('/library/store', 'App\Controller\UserLibraryController@store');
    Router::post('/library/update/{id}', 'App\Controller\UserLibraryController@update');
    Router::post('/library/destroy/{id}', 'App\Controller\UserLibraryController@destroy');
    
    Router::get('/product', 'App\Controller\ProductController@index');
    Router::get('/product/category', 'App\Controller\ProductController@category');
    Router::post('/getAliyunUploadToken', 'App\Controller\UserController@getAliyunUploadToken');

}, ['middleware' => [App\Middleware\ApiUserMiddleware::class]]);
Router::addGroup('/api',function (){
    Router::post('/getCaptchaImage', 'App\Controller\LoginController@getCaptchaImage');
    Router::post('/login', 'App\Controller\LoginController@index');
    Router::post('/refresh-token', 'App\Controller\LoginController@refreshToken');
    Router::get('/menu/getList', 'App\Controller\MenuController@getList');

});